home *** CD-ROM | disk | FTP | other *** search
- /* QuotePercent.thor by Troels Walsted Hansen
- ** $VER: QoutePercent.thor v1.00 (09.01.95)
- **
- ** Se below for details of what this script does. This script
- ** is a port of a script named QuotePercent for Spot by Kent Hansen (se below).
- */
-
- /*******************************************************************/
- /* QuotePercent v1.0 calculator for Spot */
- /* written: May 22th 1994 by */
- /* Kent Hansen (2:230/418.31@FIDONET) */
- /* e-mail: kent.hansen@scala.pink.dk */
- /* */
- /* This script calculates the percentage of quoted characters in a */
- /* message, and put up a requester showing the percentage */
- /*******************************************************************/
-
- options results
- signal on syntax
-
- /* needs THOR functions */
-
- p = ' ' || address() || ' ' || show('P',,)
- thorport = pos(' THOR.',p)
-
- if thorport > 0 then thorport = word(substr(p,thorport+1),1)
- else
- do
- say 'No THOR port found!'
- exit 10
- end
-
- /* start of action */
-
- address(thorport)
-
- LOCKGUI
-
- SAVEMESSAGE FILE 'T:Thor_1.tmp' CURRENT NOHEADER NOANSI
- if(rc ~= 0) then
- do
- REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
- signal exit
- end
-
- /* Check for quoted and new characters, skip the tagline */
-
- call open('infile', 'T:Thor_1.tmp', R)
- quoted = 0; new = 0;
-
- currentline = readln('infile')
- do while ~eof('infile') & ~(left(currentline,4) = '... ')
- if(right(word(currentline,1),1) = '>' | left(currentline,1) = '>') then quoted = quoted+length(currentline)
- else new = new+length(currentline)
- currentline = readln('infile')
- end
- call close('infile')
-
- proc = trunc((quoted/(new+quoted))*10000)/100
-
- /* Put up requester */
-
- REQUESTNOTIFY TEXT '"' || 'This message contains ' || proc || '%% of qouted text.' || '"' BT '"_Ok"'
-
- /* Cleanup */
- address command 'delete T:Thor_1.tmp quiet'
- signal exit
-
- syntax:
- say rc errortext(rc) 'in line' SIGL
- failure:
- exit:
- UNLOCKGUI
- exit
-